package com.gitee.ed.arithmetic.leetcode.common;

import cn.hutool.core.lang.ansi.AnsiColor;
import cn.hutool.core.lang.ansi.AnsiEncoder;

/**
 * @author hongda.li
 */
public final class ConsolePrinter {

    private ConsolePrinter() {
    }

    public static void printRed(String message) {
        ConsolePrinter.print(AnsiColor.BRIGHT_RED, message);
    }

    public static void printCyan(String message) {
        ConsolePrinter.print(AnsiColor.BRIGHT_CYAN, message);
    }

    public static void printGreen(String message) {
        ConsolePrinter.print(AnsiColor.BRIGHT_GREEN, message);
    }

    public static void printWhite(String message) {
        ConsolePrinter.print(AnsiColor.BRIGHT_WHITE, message);
    }

    public static void print(AnsiColor color, String message) {
        final String template = AnsiEncoder.encode(color, "%s%n");
        System.out.format(template, message);
    }

    public static void nextLine() {
        System.out.println();
    }
}
